home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 18 / fpc103.zip / COMMENT.SEQ < prev    next >
Text File  |  1988-02-01  |  3KB  |  73 lines

  1. \ COMMENT.SEQ   Allow multiple line comments in files.  by Tom Zimmer
  2.  
  3. : ?exec         ( --- )
  4.                 state @ abort" Can not be used while Compiling!" ;
  5.  
  6. : <comment:>    ( --- )
  7.                 loading @ 0= abort" COMMENT: can ONLY be used while loading"
  8.                 bl word 1+ " comment;" caps-comp 0=
  9.                 if      ['] <run> is run
  10.                 then    [compile] \ ;
  11.  
  12. : comment:      ( --- )         \ ignore all lines between.
  13.                 [compile] \
  14.                 ['] <comment:> is run ;
  15.  
  16. : <.comment:>   ( --- )
  17.                 loading @ 0= abort" .COMMENT: can ONLY be used while loading"
  18.                 bl word 1+ " comment;" caps-comp 0=
  19.                 if      ['] <run> is run
  20.                 else    key? 0=
  21.                         if      cr tib span @ 78 min type
  22.                         then
  23.                 then    [compile] \ ;
  24.  
  25. : .comment:     ( --- )         \ ignore all lines between.
  26.                 [compile] \
  27.                 ['] <.comment:> is run ;
  28.  
  29. comment: <- this marks the start line of a multi line comment.
  30.  
  31.         this is a comment line somewhere in the middle.
  32.  
  33. comment; <- this marks the end line of a multi line comment.
  34.  
  35. defer prevrun
  36.  
  37. : <#if>         ( --- )         \ ignore lines unless #else, or #endif
  38.                 begin   bl word dup c@ 0= >r 1+
  39.                         dup " #endif" caps-comp 0= over
  40.                             " #then"  caps-comp 0= or swap
  41.                             " #else"  caps-comp 0= or dup
  42.                         if      @> prevrun is run
  43.                                 >r prevrun r>
  44.                         then    r> or
  45.                 until   ;
  46.  
  47. : #else         ( --- )
  48.                 ?exec
  49.                 @> run is prevrun               \ Save previous value of RUN.
  50.                 ['] <#if> is run                \ Ignore following lines
  51.                 <#if> ;        immediate        \   and rest of this line.
  52.  
  53. : #if           ( f1 --- )      \ ignore lines following if false
  54.                 ?exec
  55.                 0=
  56.                 if      @> run is prevrun       \ Save previous value of RUN.
  57.                         ['] <#if> is run        \ Ignore following lines
  58.                         <#if>                   \   and rest of this line.
  59.                 then    ;       immediate
  60.  
  61. : #endif ; immediate    \ just a noop for the #if TRUE case.
  62. : #then ;  immediate
  63.  
  64. \s      ************* NOT LOADING BEYOND THIS LINE ***********
  65.  
  66.         \ Here is an example of how the interpreted compiler directives
  67.         \ work
  68.  
  69. cr cr .( press a T for true ) key bl or 116 =   \ wait for a key
  70.  
  71. #if .( TRUE)  #else  .( FALSE)  #then .(  always )
  72.  
  73.